package com.personal.book1.controller;

import com.personal.book1.model.DBTypes;
import com.personal.book1.model.MapTypes;
import com.personal.book1.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/y")
public class YmlController {


    @Autowired
    private MapTypes mapTypes;

    @RequestMapping("/getMap")
    public String  getMap() {
        return mapTypes.toString();
    }

















    @Autowired
    private DBTypes dbTypes;

    @RequestMapping("/getDBTypes")
    public String getDBTypes() {
        return dbTypes.toString();
    }




    @Autowired
    private Student student;

    @RequestMapping("/getStu")
    public Student getStu() {
        return student;
    }


    @Value("${string.value1}")
    private String str1;

    @Value("${string.value2}")
    private String str2;

    @Value("${string.value3}")
    private String str3;

    @RequestMapping("/getStri")
    public void getStr() {
        System.out.println(str1);
        System.out.println(str2);
        System.out.println(str3);
    }




    @Value("${mykey1.key1}")
    private String key1;

    @Value("${mykey2.key2}")
    private String key2;

    @RequestMapping("/getKey1")
    public String getKey1() {
        return "读取配置文件key1：" + key1;
    }

    @RequestMapping("/getKey2")
    public String getKey2() {
        return "读取配置文件key2：" + key2;
    }

    @Value("${spring.datasource.url}")
    private String url;

    @RequestMapping("/getUrl")
    public String getUrl() {
        return "获取Url：" + url;
    }
}
